﻿using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using Model;
using System.Data;

namespace FubiManger.UI
{
    partial class AdddayfoodForm : Smobiler.Core.Controls.MobileForm
    {
        public AdddayfoodForm() : base()
        {
            //This call is required by the SmobilerForm.
            InitializeComponent();
        }
        /// <summary>
        /// 商户ID
        /// </summary>
        public string merchantid { get; set; }
        List<ms_fresh_goods> gdlist = new List<ms_fresh_goods>();
        private void panclose_Press(object sender, EventArgs e)
        {
            this.Close();
        }

       

        private void panaddgood_Press(object sender, EventArgs e)
        {
            AddfreshfoodForm frm = new AddfreshfoodForm();
            frm.merchantid = merchantid;
            this.Form.Show(frm, false, (obj, args) =>
            {

                //刷新
               
                Getdate();//重新加载数据
            });
        }

        private void AdddayfoodForm_Load(object sender, EventArgs e)
        {
           
            Getdate();
        }
        /// <summary>
        /// 获取数据
        /// </summary>
        public void Getdate()
        {
            lvfood.Rows.Clear();
            gdlist = fresh_goodsDal.QueryTmoow(merchantid);
            DataTable table = new DataTable();
            table.Columns.Add("gdname");
            table.Columns.Add("price");
            table.Columns.Add("fgid");
            table.Columns.Add("cover");
            table.Columns.Add("sell");
            for (int i = 0; i < gdlist.Count; i++)
            {
                table.Rows.Add(gdlist[i].fg_goods_name,"￥"+ gdlist[i].fg_price, gdlist[i].fg_id, @"C:\fbimage\"+ gdlist[i].fg_cover, gdlist[i].fg_sell);
            }
            lvfood.DataSource = table;
            lvfood.DataBind();
        }
    }
}